package real.evaluation;

import real.lang.RealLangException;
import real.lang.RealObject;

public abstract class SyntacticalConstruction<T extends RealObject> implements Evaluable<T> {

	protected abstract T ProperEvaluate(Evaluator eval) throws RealLangException;
	
	public T Evaluate(Evaluator eval) throws RealLangException {
		T result;
		try {
			eval.BeginConstructionEvaluation(this);
			result = ProperEvaluate(eval);
			eval.EndConstructionEvaluation(this);
		} catch (Exception e) {
			throw new RealLangException ("Exception: "+e.toString());
		}		
		return result;
	}
	
}
